"""
3.	读取一副图像，将直方图均衡化、规定化，
并对比处理后的直方图和图像。
"""

import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
# def cv_show(name, img):
    # 显示图像
    # cv.imshow(name, img)
    # cv.waitKey()
    # cv.destroyAllWindows()
img = cv.imread('./img.png', 0)
plt.subplot(2, 2, 1), plt.imshow(img, 'gray'), plt.title("img"), plt.xticks([]), plt.yticks([])
plt.subplot(2, 2, 2), plt.hist(img.ravel(), 256), plt.title("hist"), plt.xticks([]), plt.yticks([])
img_equal = cv.equalizeHist(img)
plt.subplot(2, 2, 3), plt.imshow(img_equal, 'gray'), plt.title("img_equal"), plt.xticks([]), plt.yticks([])
plt.subplot(2, 2, 4), plt.hist(img_equal.ravel(), 256), plt.title("img_equal_hist"), plt.xticks([]), plt.yticks([])
plt.show()
